package com.wxw.BaseLibrary.http;

/**
 * @author david
 */

public enum RequestMessageType {
    Download(0, "下载"),
    Upload(1, "上传");

    private int id;
    private String name;

    RequestMessageType(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(int id) {
        for (RequestMessageType type : RequestMessageType.values()) {
            if (type.getId() == id) {
                return type.getName();
            }
        }
        return null;
    }

    public static RequestMessageType getInstance(int id) {
        for (RequestMessageType type : RequestMessageType.values()) {
            if (type.getId() == id) {
                return type;
            }
        }
        return null;
    }
}
